<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <meta http-equiv="X-UA-Compatible" content="ie=edge">
  <title>Document</title>
</head>
<body>
  <div id="app">
    <router-view></router-view>
  </div>
  <script src="./vue.js"></script>
  <script src="./vue-router.js"></script>
  <script>
    /* 
      url查询参数也可以传值

      它和动态路由的区别在于
      url长的不同
        动态路由
        www.yuedu.fm#/article/id
        url查询参数
        www.yuedu.fm#/article?id=值
    
     */
    const article = {
      template: `
        <div>
          文章详情{{$route.query.id}}
        </div>
      `,
      created () {
        console.log(this.$route.query.id)
      }
    }
    
    const routes = [
      {
        path: '/article',
        component: article
      }
    ]

    const router = new VueRouter({
      routes
    })

    const app = new Vue({
      el: '#app',
      router
    })
  
  </script>
</body>
</html>